package com.codingman.springjdbcdemo1;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo2 {
	public static void main(String[] args) {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

		EmployeeDao2 dao = (EmployeeDao2) ctx.getBean("dao2");
		
//		dao.save(new Employee(105, "Jack", 20000));

		List<Employee> list = dao.getAll();
		for (Employee e : list) {
			System.out.println(e.getId() + " " + e.getName() + " " + e.getSalary());
		}

		List<Employee> list2 = dao.getAllByRowMapper();
		for (Employee e : list2) {
			System.out.println(e.getId() + " " + e.getName() + " " + e.getSalary());
		}
	}
}